<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script>
//childNodes   FF下把空文本当作一个子节点
//nodeType  3==文本节点  1==元素节点
window.onload=function(){
	var ul=document.getElementById('ul1');
//	alert(ul.childNodes.length)	
//	ul.childNodes[0].style.background='red';
	//alert(document.body.childNodes[0].nodeType)	
	
	for(var i=0;i<ul.childNodes.length;i++){
		if(ul.childNodes[i].nodeType==1){
			ul.childNodes[i].style.background='red';	
		};	
	};
};



</script>
</head>

<body>
<ul id="ul1">
    <li>111</li>
    <li>222</li>
    <li>333</li>
</ul>
</body>
</html>
